// LeanCloud API 连接测试脚本
import { LEANCLOUD_CONFIG } from './src/config/leancloud.js';

console.log('=== LeanCloud 配置测试 ===');
console.log('App ID:', LEANCLOUD_CONFIG.appId);
console.log('App Key:', LEANCLOUD_CONFIG.appKey ? '已配置' : '未配置');
console.log('Server URL:', LEANCLOUD_CONFIG.serverURL);

// 测试 API 连接
async function testConnection() {
  try {
    const response = await fetch(`${LEANCLOUD_CONFIG.serverURL}/1.1/classes/_User`, {
      method: 'GET',
      headers: {
        'X-LC-Id': LEANCLOUD_CONFIG.appId,
        'X-LC-Key': LEANCLOUD_CONFIG.appKey,
        'Content-Type': 'application/json'
      }
    });
    
    if (response.ok) {
      console.log('✅ LeanCloud API 连接成功');
      const data = await response.json();
      console.log('响应数据:', data);
    } else {
      console.log('❌ LeanCloud API 连接失败:', response.status, response.statusText);
    }
  } catch (error) {
    console.log('❌ LeanCloud API 连接错误:', error.message);
  }
}

// 运行测试
testConnection();
